(C) 1996 AROS - The Amiga Replacement OS
#includeint main (int argc, char ** argv) { struct List list; struct Node node; struct Usage { struct Node node; int data; } usage; /* Initializing the list */ NewList (&list); /* Adding a node to the list */ AddHead (&list, &node); /* But most of the time, you will do something like this: The struct Usage contains a node as it's first field. Now you can collect any number of struct Usage structures in a list. */ AddTail (&list, (struct Node *)&usage); /* If you want to avoid the cast, you can of course do this: AddTail (&list, &usage.node); but sometimes you won't, because then you can write general functions to handle lists with all kinds of nodes in them. */ return 0; } /* main */
Easier code to handle stacktags and stackmethods.